package com.wn.pianTai.fanoutExchange;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class FanoutExchangeConfig {

    /**
     * 建立一个队列
     * 一个交换机
     *交换机和队列绑定关系
     * 广播模式
     * @return
     */

    @Bean
    public Queue fanoutQueue() {
        return new Queue("fanoutQueue");
    }

    @Bean
    public FanoutExchange fanoutExchange() {
        return new FanoutExchange("fanoutExchange");
    }

    @Bean
    public Binding fanoutBinding() {
        return BindingBuilder.bind(fanoutQueue()).to(fanoutExchange());
    }
}
